'''
Created on 2009-11-15

@author: Administrator
'''
from google.appengine.ext import db
from google.appengine.api import images
from mod.tpl import Tpl
from app.userfac import UserFac
class Account(Tpl):
    '''
    classdocs
    '''


    def get(self):
        tplval = {}
        member = UserFac().getUser(self)
        tplval["member"] = member
        self.display("account.html", tplval)
    def post(self):
        
        nickname = self.request.get("nickname")
        avatar = self.request.get("avatar")
        member = UserFac().getUser(self)
        member.nickname = nickname
        if avatar:
            avatar = images.resize(self.request.get("avatar"), 48, 48)
            imgbody = db.Blob(avatar)
            member.avatar = imgbody
        member.put()
        self.redirect("/")